import request from '@/untils/request.js'


//提供调用注册接口的函数
export const userRegisterService = (registerData) => {
    // 将注册数据转换为JSON字符串
    const jsonData = JSON.stringify(registerData);
    // 设置请求头为application/json
    const config = {
        headers: {
            'Content-Type': 'application/json'
        }
    };
    return request.post('/user/register', jsonData, config);
};
//登录接口
export const userLoginService = (loginData) => {
    // 将注册数据转换为JSON字符串
    const jsonData = JSON.stringify(loginData);
    // 设置请求头为application/json
    const config = {
        headers: {
            'Content-Type': 'application/json'
        }
    };
    return request.post('/user/login', jsonData, config);
};

//获取用户详细信息
export const userInfoService = () => {
    return request.get('/user/queryAll')
}
//删除离职的用户
export const deleteUserService = (userId) => {
    // 使用模板字符串来构建 URL
    return request.delete(`/user/${userId}`)
}

//重置密码
export const updateUserPwdService = (userPwdData) => {
    return request.patch('/user/updatePwd', userPwdData)
}
